import sa4.MainFramework
import sa4.Form


object test1 extends App {

  
  var framework = new MainFramework()
  
  framework.addRoute("/notEmpty", null)
  assert(framework.routeTable.isEmpty == false)
  println("table not empty")
  
  framework.addRoute("/test", null)
  assert(framework.routeTable.contains("/test") == true)
  println("table contains test route")
  
  assert(framework.routeTable.size == 2)
  println("correct size")
  
  var input1 = "ciao"
  var input2 = "culo"
  var list = List((input1, input2))
  
  var form1 = new Form("method", "handler")
  
  var strform1 = form1.testForm()
  assert("<form " + "method=\"" + "method" + "\" handler=\"" + "handler" + "\" ></form>"==strform1)
  println("form correct")
  
  form1.addInput("","String", "input1")
  var strform2 = form1.testForm()
  var strbasic = "<form " + "method=\"" + "method" + "\" handler=\"" + "handler" + "\" > "
  var strI = "<form method=\"method\" handler=\"handler\" > <p> <input name=\"input1\" type=\"String\"></input> </p></form>"
  var str = strbasic + strI
  assert(strI == strform2)
  print("added input1")
  
  form1.removeInput("input1")
  assert("<form " + "method=\"" + "method" + "\" handler=\"" + "handler" + "\" ></form>"==strform1)
  print("remove works")
  
  form1.addInput("","radio","input2")
  assert("<form method=\"method\" handler=\"handler\" > <p> <input value=\"input2\" type=\"radio\"></input> </p></form>" == form1.testForm())
  print("added radio input")
}